﻿/*<summary>
Created By : Swati
Created On : 10/16/2008
Class Name : WardBed_DataLoader
Used In    : 
------------------------------------------------------------------------
Modification Log  
------------------------------------------------------------------------
Created By        Modified By         Remarks                             
-----------       ------------        ----------------------------------
                                                                          
------------------------------------------------------------------------
</summary>*/

using System.Xml;
using System.Data;
using System;
using Utils;
using System.Data.SqlClient;
using System.Collections;

namespace InPatientController
{
    public class WardBed_DataLoader
    {
        public DataSet Get_All_Wards()
        {
            ezUtilsAdapter DBL = new ezUtilsAdapter();
            DataSet ds = null;

            try
            {
                ds = DBL.RunSPReturnDataSet("SP_GetAllWards", "TR");
                return ds;
            }
            catch (SqlException ex)
            {
                string errorMessage = String.Format(
                    "An Error Occurred While Loading the Ward Information from the DB. Message: {0}", ex.Message);
                return ds;
            }
            finally
            {
                DBL.Dispose();
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
        }

        public DataSet Get_Available_Beds(string wardId)
        {
            ezUtilsAdapter DBL = new ezUtilsAdapter();
            DataSet ds = null;

            try
            {
                ds = DBL.RunSPReturnDataSet("SP_GetAvailableBeds", "TR", 
                                 new SqlParameter("@vchWardID", wardId));
                return ds;
            }
            catch (SqlException ex)
            {
                string errorMessage = String.Format(
                    "An Error Occurred While Loading the Ward Information from the DB. Message: {0}", ex.Message);
                return ds;
            }
            finally
            {
                DBL.Dispose();
                if (ds != null)
                {
                    ds.Dispose();
                }
            }
        }

        public void Dispose()
        {
            this.Dispose(true);
            System.GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
        }
    }
}
